let video = {
  state: {
    wayNum: 0,
    videoList: [], //视频容器
  },
  mutations: {
    SET_WAYNUM(state, num) {
      state.wayNum = num;
    },
    // 添加视频流
    ADD_VIDEO: (state, data) => {
      console.log(state.videoList);
    },
    ADD_CASE_VIDEO: (state, data) => {
      console.log("ADD_CASE_VIDEO", data);
    },
  },
  actions: {
    setWaynum({ commit }, num) {
      commit("SET_WAYNUM", num);
      sessionStorage.setItem("wayNum", num);
    },
    addVideo({ commit, state }, data) {
      var exists = Array.from(state.videoList).some((ele) => {
        if (ele.stream) {
          return ele.stream.getID() === data.getID();
        } else {
          return false;
        }
      });
      if (!exists) {
        console.log("不相同添加流", data);
        commit("ADD_VIDEO", data);
        commit("ADD_VIDEO", data);
      }
    },
  },
  namespaced: true,
};

export default video;
